#use the latest LTS (long term support) version 12 of node available from the Docker Hub
FROM node:14 as build
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@6+)

COPY . .

RUN npm config set registry https://registry.npmmirror.com 
RUN npm install
RUN npm run build:prod


FROM nginx:latest

WORKDIR /usr/share/nginx/html
COPY --from=build /usr/src/app/ /usr/share/nginx/html
RUN ls
COPY nginx.conf /etc/nginx/nginx.conf

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]

